import {GetQwen} from "@/agent/base/llm.ts"
import {MainState} from "@/agent/base/state.ts";
import {ChatPromptTemplate} from "@langchain/core/prompts";
import prompts from '@/agent/prompt/collect.ts'

const {GuidePrompt} = prompts

export const GuideNode = async (state: typeof MainState.State) => {

    const llm = await GetQwen()

    const template = await ChatPromptTemplate.fromMessages([
        ["system", "你是一个功能路由向导，按照用户要求完成任务"],
        ["human", GuidePrompt]
    ]).invoke({userInput: state.userInput})

    const resp = await llm.invoke(template)

    return {messages: [resp]}

}